package com.pd;

import com.pd.mapper.*;
import com.pd.pojo.ItemVO;
import com.pd.pojo.PdOrder;
import com.pd.pojo.PdOrderItem;
import com.pd.pojo.PdShipping;
import com.pd.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Random;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/12/1
 */
@Component
@RabbitListener(queues = "orderQueue")
public class OrderConsumer {
    @Autowired
    private OrderService orderService;

    @RabbitHandler
    public void receive(PdOrder pdOrder) throws Exception {
        orderService.saveOrder(pdOrder);
        System.out.println("-------------------------------订单保存-----------------------------------------------");
    }
}
